//localStorage 模块封装
//使用localStorage实现持久化
// 而 sessionStorage 刷新还在，关闭浏览器就消失了
//存
const setItem = (key, str) => {
  localStorage.setItem(key, JSON.stringify(str));
};

//取
const getItem = key => {
  return JSON.parse(localStorage.getItem(key));
};

//删
const delItem = key => {
  localStorage.removeItem(key);
};

//导出
export { setItem, getItem, delItem };
